package biz.ezcom.spring.mvc.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import biz.ezcom.spring.mvc.dao.PersonDao;
import biz.ezcom.spring.mvc.domain.Person;
import biz.ezcom.spring.mvc.service.PersonService;

@Service
public class PersonServiceImpl implements PersonService {
	private PersonDao personDao;

	public PersonDao getPersonDao() {
		return personDao;
	}
	@Resource
	public void setPersonDao(PersonDao personDao) {
		this.personDao = personDao;
	}

	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public int insert(Person person){
		return personDao.insert(person);
	}
	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public int deleteById(int id) {
		return personDao.deleteById(id);
	}
	@Override
	@Transactional(propagation=Propagation.REQUIRED)
	public int updateById(Person person) {
		return personDao.updateById(person);
	}
	@Override
	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public Person selectById(int id) {
		return personDao.selectById(id);
	}
	
}
